package com.hhf.cloud.controller;

import com.hhf.cloud.resp.Result;
import com.hhf.cloud.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Daniel-黄海峰
 * @Description
 * @create 2024/3/2 16:18
 * AT模式
 */
@RestController
public class AccountController {

    @Autowired
    private AccountService accountService;

    /**
     * 扣减账户余额
     */
    @RequestMapping("/account/decrease")
    public Result<String> decrease(@RequestParam("userId") Long userId,
                                   @RequestParam("money") Long money){
        accountService.decrease(userId,money);
        return Result.success("扣减账户余额成功！");
    }
}
